package com.wujing.scala.first7Day

import scala.util.control.Breaks
/**
 * break && continue
 */
object BreakDemo {
  def main(args: Array[String]): Unit = {

      var num  = 10

    //可以接收函数的函数编程
    //  def breakable(op : => scala.Unit) : scala.Unit = { /* compiled code */ }
    //使用 Breaks对象

    val loop = new Breaks;
    loop.breakable(
      printHello(loop)

    )


  }

  def printHello(loop:Breaks): Unit ={
    for (i <- 10 to 100){
      printf("hello world  ===/d",i)
      if (i==55) loop.break
    }
  }

}
